package com.changcheng.project.yuminsi.controller;

import com.changcheng.framework.aspectj.LogPointcut;
import com.changcheng.project.yuminsi.service.OperpermService;
import com.changcheng.project.yuminsi.vo.BaseOutput;
import com.changcheng.project.yuminsi.vo.PasswordChangeRequest;
import com.changcheng.project.yuminsi.vo.UserLoginRequest;
import com.changcheng.project.yuminsi.vo.UserLoginResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author yuminsi
 * @description
 * @date 2020/9/11 10:35
 * @since
 */
@Api(description = "用户登录以及密码修改接口")
@RestController
@RequestMapping("/v1.0/etc")
public class OperpermController {

    @Autowired
    private OperpermService operpermService;

    @ApiOperation(value = "用户登陆接口", notes = "用户登陆接口")
    @LogPointcut(description = "用户登陆接口")
    @PostMapping("/auth/loginForDealer")
    public BaseOutput loginForDealer(@RequestBody UserLoginRequest userLoginRequest) throws Exception {
        return operpermService.loginForDealer(userLoginRequest);
    }

    @ApiOperation(value = "账号密码修改接口", notes = "账号密码修改接口")
    @LogPointcut(description = "账号密码修改接口")
    @PostMapping("/account/changePassword")
    public BaseOutput changePassword(@RequestBody PasswordChangeRequest passwordChangeRequest) throws Exception {
        return operpermService.changePassword(passwordChangeRequest);
    }
}
